﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

using QLTTAN.DTO;
namespace QLTTAN.DAL
{
    public class PhanCongDAL
    {
        ConnectionData conn;

        // Load PhanCong với mã GV.
        public DataTable PhanCong_Load(PhanCongDTO PC_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaLop";
            value[0] = PC_DTO.MaLop;

            return conn.GetData("PHANCONG_GIAOVIEN_GIANGDAY", name, value, Nparameter);
        }

        public int PhanCong_Insert(PhanCongDTO PC_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaLop";
            value[0] = PC_DTO.MaLop;
            name[1] = "MaGV";
            value[1] = PC_DTO.MaGV;

            return conn.UpdateData("PHANCONG_INSERT", name, value, Nparameter);
        }

        public int PhanCong_Update(PhanCongDTO PC_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaLop";
            value[0] = PC_DTO.MaLop;
            name[1] = "MaGV";
            value[1] = PC_DTO.MaGV;

            return conn.UpdateData("PHANCONG_UPDATE", name, value, Nparameter);
        }

        public int PhanCong_Delete(PhanCongDTO PC_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaLop";
            value[0] = PC_DTO.MaLop;
            name[1] = "MaGV";
            value[1] = PC_DTO.MaGV;

            return conn.UpdateData("PHANCONG_DELETE", name, value, Nparameter);
        }
    }
}
